package com.tanhua.dubbo.api;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.tanhua.dubbo.mappers.SettingMapper;
import com.tanhua.model.db.Settings;
import org.apache.dubbo.config.annotation.DubboService;
import org.springframework.beans.factory.annotation.Autowired;

/**
 * @program: tanhua
 * @description:
 * @author: MR.peng
 * @create: 2022-03-10 10:24
 **/

@DubboService
public class SettingApiImpl implements SettingApi {

    @Autowired
    private SettingMapper settingMapper;

    @Override
    public Settings findUserById(Long userId) {
        QueryWrapper<Settings> qw = new QueryWrapper<>();
        qw.eq("user_id",userId);
        return settingMapper.selectOne(qw);

    }

    //保存
    @Override
    public void save(Settings settings) {
        settingMapper.insert(settings);
    }

    //更新
    @Override
    public void update(Settings settings) {
        settingMapper.updateById(settings);
    }
}
